<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    
    <head>
        <meta charset="UTF-8">
        <title>职位栏</title>
        <header th:replace="header::html"></header>
    </head>

    <body>

        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input class="layui-input" placeholder="职位名" name="cate_name"></div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon"></i>增加</button>
                                </div>
                            </form>
                            <hr>

                        </div>
                        <!--  部门列表  -->
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                              <thead>
                                <tr>
                                  <th width="70">ID</th>
                                  <th>职位名</th>
                                  <th width="250">操作</th>
                              </thead>

                              <tbody class="x-cate" th:each="pst : ${positions.list}">
                                <tr cate-id='1' fid='0' >
                                  <td th:text="${pst.id}">1</td>
                                  <td th:text="${pst.name}">
                                    产品管理
                                  </td>
                                  <td class="td-manage">
                                    <a class="layui-btn layui-btn layui-btn-xs" th:href="@{/position/{id}(id=${pst.id})}" ><i class="layui-icon">&#xe615;</i>查询</a>
                                    <button class="layui-btn-danger layui-btn layui-btn-xs"  onclick="member_del(this,'要删除的id')" href="javascript:;" ><i class="layui-icon">&#xe640;</i>删除</button>
                                  </td>
                                </tr>
                              </tbody>

                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                    <a class="prev" href="" th:href="@{/department/(pageNum=${positions.hasPreviousPage}?${positions.prePage}:1)}">上一页</a>
                                    <a class="next" href="" th:href="@{/department/(pageNum=${positions.hasNextPage}?${positions.nextPage}:${positions.pages})}">下一页</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script>
          layui.use(['form'], function(){
            form = layui.form;

          });

           /*用户-删除*/
          function member_del(obj,id){
              layer.confirm('确认要删除吗？',function(index){
                  //发异步删除数据
                  $(obj).parents("tr").remove();
                  layer.msg('已删除!',{icon:1,time:1000});
              });
          }




          var cateIds = [];
          function getCateId(cateId) {
              $("tbody tr[fid="+cateId+"]").each(function(index, el) {
                  id = $(el).attr('cate-id');
                  cateIds.push(id);
                  getCateId(id);
              });
          }
   
        </script>
    </body>
</html>
